package collections1;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Scanner;

public class Father {
	
  public static void main(String[] args) {
	Scanner sc = new Scanner(System.in );
					Calendar c = Calendar.getInstance();
					System.out.println("请输入年份：");
					int year = sc.nextInt();
					c.set(Calendar.YEAR, year);
					c.set(Calendar.MONTH, 6 - 1);
					int MaxDay = c.getActualMaximum(Calendar.DAY_OF_MONTH);
					int sunday = 0;
					for (int i = 1; i <= MaxDay; i++) {
						c.set(Calendar.DATE, i);
						// 判断是周日
						if (c.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
							sunday++;
							// 第三个周日，返回
							if (sunday == 3) {
								break;
							}
						}
					}
					String date = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime());
					System.out.printf(year + "年的父亲节是：" + date);
  }
}
